﻿<Window x:Class="WPFExcelReport.MetroWindow"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                      xmlns:ucd="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Controls"
                      xmlns:cv="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls" 
                     xmlns:Menus="clr-namespace:WPFExcelReport;assembly=TICC_MENUDEF"
                     xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"   
                     xmlns:HR="clr-namespace:WPFExcelReport;assembly=TICC_HRSTAMM"
                     xmlns:WF="clr-namespace:WPFExcelReport;assembly=TICC_WFEVENTS"
                     xmlns:Localization="clr-namespace:Localization;assembly=Localization" 
                    xmlns:MAH="http://metro.mahapps.com/winfx/xaml/controls"
                     ResizeMode="CanResizeWithGrip" 
                      FontSize="14"
                     Name="TV"
                     WindowState="Maximized">
    <Window.Resources>
        <DataTemplate x:Key="ThemeItemTemplate">
            <Border ToolTip="{Binding Name}">
                <StackPanel Orientation="Vertical">
                    <Image Source="{Binding Image}" Stretch="None"/>
                    <TextBlock Text="{Binding Path=Name, Mode=OneWay}" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </StackPanel>
            </Border>
        </DataTemplate>
        <cv:BoolToVisibilityConverter  x:Key="bv"/>
        <cv:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <cv:String2ColorConverter x:Key="sc"/>
        <cv:NOTConverter  x:Key="not"/>
    </Window.Resources>
    <Grid x:Name="Maingrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <HR:TLOGIN  Grid.Row="1" 
                    Visibility="{Binding IsLogOn,ElementName=TV,Converter={StaticResource ResourceKey=nbv}}"  
                    IsLogOn="{Binding IsLogOn,ElementName=TV}"/>
        <MAH:MetroTabControl  Grid.Row="1" x:Name="MainTab" SelectedIndex="1" 
                     Visibility="{Binding IsLogOn,Converter={StaticResource ResourceKey=bv}}">
            <MAH:MetroTabItem Header="日志" 
                             Tag="Log"
                                   CloseButtonEnabled="False"
                                   Visibility="{Binding IsShowLog,Converter={StaticResource bv}}">
                <WF:TWFLOG />
            </MAH:MetroTabItem>
            <MAH:MetroTabItem Header="菜单" Tag="Menu" CloseButtonEnabled="False">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="1*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <ex:AniScrollViewer Grid.Row="0" Grid.Column="0"   HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
                        <Menus:TMENU  x:Name="MainMenu"/>
                    </ex:AniScrollViewer>
                </Grid>
            </MAH:MetroTabItem>
        </MAH:MetroTabControl>
        <Grid Grid.Row="0" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="1*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <WrapPanel Grid.Column="1" HorizontalAlignment="Left">
                <ucd:StatusBar Grid.Row="0"   x:Name="MainStatusBar" />
                <Button   Click="SetMasterCommand"  Margin="5,0,0,0" Width="24" Height="20" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Extend.png" />
                    </Button.Background>
                </Button>
                <Button   Click="SetLogCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/help.png" />
                    </Button.Background>
                </Button>
                <Button   Click="CloseWindowCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Delete.png" />
                    </Button.Background>
                </Button>
                <Button   Click="SetLogOnCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/User.png" />
                    </Button.Background>
                </Button>
                <Button   Click="DBQueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/build.png" />
                    </Button.Background>
                </Button>
                <WrapPanel Visibility="{Binding IsTST,Converter={StaticResource bv}}">
                    <Button Click="TSModeCommand" Height="20" Margin="5,0,0,0" 
                            Visibility="{Binding IsTS,Converter={StaticResource bv}}"
                            Content="TS" Foreground="Red" Width="Auto"/>
                    <Button Click="TMModeCommand" Height="20" Margin="5,0,0,0" 
                             Visibility="{Binding IsTS,Converter={StaticResource nbv}}"
                            Content="TM" Foreground="Green"  Width="Auto" />
                </WrapPanel>
            </WrapPanel>
        </Grid>
    </Grid>
</Window>
